package com.goldmantis.ssm.util;

import java.util.HashMap;
import java.util.Map;

public class ReturnMessage {

    private int statusCode;

    private String message;

    private Map<String,Object> otherInfo=new HashMap<String, Object>();


    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Map<String, Object> getOtherInfo() {
        return otherInfo;
    }

    public void setOtherInfo(Map<String, Object> otherInfo) {
        this.otherInfo = otherInfo;
    }


    public static ReturnMessage success(){
        ReturnMessage returnMessage=  new ReturnMessage();
        returnMessage.setStatusCode(1);
        returnMessage.setMessage("处理成功");

        return returnMessage;
    }

    public static ReturnMessage failure(){
        ReturnMessage returnMessage=new ReturnMessage();
        returnMessage.setStatusCode(0);
        returnMessage.setMessage("处理失败");

        return returnMessage;
    }

    public ReturnMessage add(String key,Object value){
        this.getOtherInfo().put(key,value);
        return this;
    }
}
